package com.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.common.mybatis.Page;
import com.entity.Attachment;
import com.entity.AttachmentRelationship;
import com.repository.AttaRelationshipDao;
import com.repository.AttachmentDao;
import com.service.base.BaseServiceImp;
@Service("AttachmentService")
public class AttachmentServiceImp extends BaseServiceImp<Attachment> implements AttachmentService{
	
	//附件
	@Autowired
	private AttachmentDao attdao;
	//附件关系
	@Autowired
	private AttaRelationshipDao AttreDao;
	
	
	@Override
	public Page<Attachment> findByPageId(Attachment o, Page<Attachment> pag,
			String  Name,String Id) {
		pag.setResults(attdao.findByPageId(o, pag,Name,Id));

		return pag;
	}

	@Transactional
	@Override
	public void deleteAnd(Attachment att) {
		attdao.delete(att);
		AttachmentRelationship attre=new AttachmentRelationship();
		attre.setAttachmentId(att.getAttachmentId());
		AttreDao.delete(attre);
	}
	

}
